import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '@/layout'
import dashboardRouter from './page/dashboard/index'
import testRouter from './page/test/index'
import taskUiRouter from './page/taskUi/index'
import errorRouter from './page/error/index'
import frameRouter from './page/frame/index'
import outSide from './page/outSide/index'
import author from './page/author'
import stystemRouter from './page/system'
import monitorRouter from './page/monitor'
import personalRouter from './page/personal'
import pageLayoutRouter from './page/pageLayout'
import portalPublicRouter from './page/portalPublic'
import {
  ChiefInvestmentRouter,
  ChiefOperatingRouter
} from './page/chiefPortal'
import ChiefComponentsRouter from './page/chiefPortal/components'
import dataEditor from './page/dataEditor'
import workBeachRouter from './page/workBeach'
Vue.use(VueRouter)
export const constantRoutes = [
  // 固定首页
  {
    path: '/dashboard/personal/home',
    meta: { title: '首页', affix: true },
    name: 'home'
  }
]

export const asyncRoutes = []
const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/page/login/index'),
    meta: {
      title: '登陆'
    }
  },
  {
    path: '/',
    component: layout,
    redirect: '/dashboard'
  },
  {
    path: '/Chief/components',
    component: () => import('@/views/chiefPortal/Chief'),
    meta: {
      title: '门户首页'
    }
  },
  ...ChiefComponentsRouter,
  author,
  stystemRouter,
  monitorRouter,
  personalRouter,
  pageLayoutRouter,
  portalPublicRouter,
  {
    path: '/redirect',
    component: layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
    path: '/info',
    component: layout,
    redirect: '/info/index',
    children: [
      {
        path: 'index',
        name: '个人信息',
        meta: { keepAlive: true, title: '个人信息' },
        component: () =>
          import(/* webpackChunkName: "page" */ '@/views/admin/user/info')
      }
    ]
  },
  dashboardRouter,
  testRouter,
  taskUiRouter,
  errorRouter,
  frameRouter,
  ChiefInvestmentRouter,
  ChiefOperatingRouter,
  outSide,
  dataEditor,
  workBeachRouter
  // authorRouter
  // { path: "*", redirect: "/error/404", hidden: true }
]

const router = new VueRouter({
  routes
})

export default router
